package com.hopeland.androidpc.jilintongdaomen.room.dao;

import androidx.annotation.NonNull;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Transaction;
import androidx.room.Update;

import com.hopeland.androidpc.jilintongdaomen.room.entry.RfidRoomInfo;

import java.util.List;

import io.reactivex.Completable;
import io.reactivex.Maybe;

@Dao
public interface RfidRoomDao {

    @Transaction
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Completable insert(@NonNull RfidRoomInfo tempRoomInfo);

    @Transaction
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(@NonNull List<RfidRoomInfo> tempRoomInfos);

    @Transaction
    @Update
    Completable updateBrushRoomInfo(@NonNull RfidRoomInfo tempRoomInfo);

    @Transaction
    @Delete
    Completable delete(@NonNull RfidRoomInfo rfidRoomInfo);

    @Query("SELECT * FROM rfid_info")
    Maybe<List<RfidRoomInfo>> queryAll();

    @Query("SELECT * FROM rfid_info WHERE  epc_asicc =:epc_asicc ")
    Maybe<RfidRoomInfo> queryRfidData(String epc_asicc);




}
